﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;

namespace Portal
{
    public static class SelectItem
    {

        /// <summary>
        /// 获取学历列表
        /// </summary>
        /// <returns></returns>
        public static IEnumerable<SelectListItem> Degree()
        {
            return GetCategorySelectList(CategoryTypeEnum.Degree);
        }
        public static IEnumerable<SelectListItem> WorkType()
        {
            return GetCategorySelectList(CategoryTypeEnum.WorkType);
        }
        public static IEnumerable<SelectListItem> Sex()
        {
            return GetCategorySelectList(CategoryTypeEnum.Sex);
        }
        public static IEnumerable<SelectListItem> Post()
        {
            return GetCategorySelectList(CategoryTypeEnum.Post);
        }
        public static IEnumerable<SelectListItem> WorkExperience()
        {
            return GetCategorySelectList(CategoryTypeEnum.WorkExperience);
        }
        public static IEnumerable<SelectListItem> WayFor()
        {
            return GetCategorySelectList(CategoryTypeEnum.WayFor);
        }
        public static IEnumerable<SelectListItem> Workplace()
        {
            return GetCategorySelectList(CategoryTypeEnum.Workplace);
        }
        public static IEnumerable<SelectListItem> Language()
        {
            return GetCategorySelectList(CategoryTypeEnum.Language);
        }
        public static IEnumerable<SelectListItem> AssessmentMethod()
        {
            return GetCategorySelectList(CategoryTypeEnum.AssessmentMethod);
        }

        private static IEnumerable<SelectListItem> GetCategorySelectList(CategoryTypeEnum categoryTypeEnum)
        {
            return CategoryCache.GetList().Where(o => o.Type == (int)categoryTypeEnum).Select(o => new SelectListItem { Text = o.Name, Value = o.Id });
        }

    }
}
